﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using XNADota.Graphics.Techniques;

namespace XNADota.Graphics
{
    public class PaletteRendererManager : GameComponent
    {
        private Dictionary<EPaletteRendererType, PaletteRendererContainer> _PaletteRendererContainer;

        public PaletteRendererManager(Game game)
            : base(game)
        {
            // Create palette renderers
            _PaletteRendererContainer = new Dictionary<EPaletteRendererType, PaletteRendererContainer>();

            _PaletteRendererContainer.Add(EPaletteRendererType.Cliff, new CliffPaletteRendererContainer(game));
            _PaletteRendererContainer.Add(EPaletteRendererType.Doodad, new DoodadPaletteRendererContainer(game));
            _PaletteRendererContainer.Add(EPaletteRendererType.Unit, new UnitPaletteRenderContainer(game));

            _PaletteRendererContainer.Add(EPaletteRendererType.Sprite, new SpritePaletteRendererContainer(game));
        }

        public PaletteRenderer GetPaletteRenderer(EPaletteRendererType PaletteType, string name)
        {
            return _PaletteRendererContainer[PaletteType].GetPaletteRenderer(name);
        }

        public PaletteRendererContainer this[EPaletteRendererType type]
        {
            get { return _PaletteRendererContainer[type]; }
        }
    }
}
